/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.apt.updateAcc;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 *
 * @author Bach
 */
public class UpdateAccAdminForm extends org.apache.struts.action.ActionForm {

    private String username;
    private String email;
    private String oldpass;
    private String newpass;
    private String repass;
    private String accId;

    public UpdateAccAdminForm() {
        super();
        // TODO Auto-generated constructor stub
    }

    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        if (getUsername() == null || getUsername().length() < 1) {
            errors.add("name", new ActionMessage("error.AdminLoginForm.name.required"));
            // TODO: add 'error.name.required' key to your resources
        } else if (getOldpass() == null || getOldpass().length() < 1) {
            errors.add("pass", new ActionMessage("error.AdminLoginForm.pass.required"));
            // TODO: add 'error.name.required' key to your resources
        } else if (getNewpass() == null || getNewpass().length() < 1) {
            errors.add("passnew", new ActionMessage("error.AdminLoginForm.pass.required"));
            // TODO: add 'error.name.required' key to your resources
        } else if (getRepass() == null || getRepass().length() < 1) {
            errors.add("passre", new ActionMessage("error.AdminLoginForm.pass.required"));
            // TODO: add 'error.name.required' key to your resources
        }
        return errors;
    }

    /**
     * @return the username
     */
    public String getUsername() {
        return username;
    }

    /**
     * @param username the username to set
     */
    public void setUsername(String username) {
        this.username = username;
    }

    /**
     * @return the email
     */
    public String getEmail() {
        return email;
    }

    /**
     * @param email the email to set
     */
    public void setEmail(String email) {
        this.email = email;
    }

    /**
     * @return the oldpass
     */
    public String getOldpass() {
        return oldpass;
    }

    /**
     * @param oldpass the oldpass to set
     */
    public void setOldpass(String oldpass) {
        this.oldpass = oldpass;
    }

    /**
     * @return the newpass
     */
    public String getNewpass() {
        return newpass;
    }

    /**
     * @param newpass the newpass to set
     */
    public void setNewpass(String newpass) {
        this.newpass = newpass;
    }

    /**
     * @return the repass
     */
    public String getRepass() {
        return repass;
    }

    /**
     * @param repass the repass to set
     */
    public void setRepass(String repass) {
        this.repass = repass;
    }

    /**
     * @return the accId
     */
    public String getAccId() {
        return accId;
    }

    /**
     * @param accId the accId to set
     */
    public void setAccId(String accId) {
        this.accId = accId;
    }
}
// public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
//        ActionErrors errors = new ActionErrors();
//        if (getName() == null || getName().length() < 1) {
//            errors.add("name", new ActionMessage("error.name.required"));
//            // TODO: add 'error.name.required' key to your resources
//        }
//        return errors;
//    }